package com.wlcj.www.model.data;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;

public class PlatformQuestion extends Model<PlatformQuestion> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7639725759974461272L;
	
	public static final PlatformQuestion dao = new PlatformQuestion();

	public List<PlatformQuestion> getQuestion() {
		String sql = "select w.*,p.provinces_name from wd_new_platform_problem w,wd_d_provinces p where w.provinces_id=p.provinces_id";
		return dao.find(sql);
	}
	
	public List<PlatformQuestion> getQuestion(String time,Integer area,Integer type,String orderby){
		StringBuilder sb = new StringBuilder();
		sb.append("select w.*,p.provinces_name from wd_new_platform_problem w,wd_d_provinces p where w.provinces_id=p.provinces_id ");
		// time
		if(time!=null){
			sb.append(" and w.problem_time='"+time+"'");
		}
		if(area!=null){
			sb.append(" and w.provinces_id='"+area+"'");
		}
		if(type!=null){
			sb.append(" and w.problem_type='"+type+"'");
		}
		sb.append(" order by"+orderby);
		
		return dao.find(sb.toString());
	}
}
